from typing import List, Set, Tuple, Dict


# 类型提示用来声明一个变量的类型


def get_full_name(first_name: str, last_name: str):
    full_name = first_name.title() + " " + last_name.title()
    return full_name


print(get_full_name("john", 'doe'))


def get_name_with_age(name: str, age: int):
    # name_wit_age = name + "is this old: " + age
    name_wit_age = name + "is this old: " + str(age)
    return name_wit_age


# 简单类型
def get_items(a: str, b: int, c: float, d: bool, e: bytes):
    return a, b, c, d, e


print(get_items("123,", 100, 3.14, True, b'010'))


# 嵌套类型

def process_items(items: list[str]):
    """
    :param items:定义一个由 str 组成的 list 变量。
    :return:
    """
    for item in items:
        print(item)


process_items(['123', '234'])


def process_items(items_t: Tuple[int, int, str], items_s: Set[bytes]):
    return items_t, items_s


print(process_items((123, 1, '234'), {b'123', }))


def process_dict(prices: Dict[str, float]):
    for k, v in prices.items():
        print(k)
        print(v)


process_dict({'age': 18.0})


# 类作为类型
class Person:
    def __init__(self, name: str):
        self.name = name


def process_person(person: Person):
    return person.name


print(process_person(Person('aaa')))
